package mycharset;

import java.io.UnsupportedEncodingException;
import java.util.Arrays;

public class MyCharSetDemo1 {
    public static void main(String[] args) throws UnsupportedEncodingException {
        String s = "ai你哟";
        byte[] bytes1 = s.getBytes();
        //UTF-8
        System.out.println(Arrays.toString(bytes1));
        String s1 = new String(bytes1);
        System.out.println(s1);
        //GBK
        byte[] bytes2 = s.getBytes("GBK");
        System.out.println(Arrays.toString(bytes2));
        String s2 = new String(bytes2, "GBK");
        System.out.println(s2);
    }
}
